#include "factory.h"
#include "deliver.h"
#include <memory>

void Client(int pro, int fac, int del)
{
	std::shared_ptr<AbstractFactory> factory;
	std::shared_ptr <AbstractDeliver> delivery;
	std::shared_ptr <AbstractProductA> proA;
	std::shared_ptr <AbstractProductB> proB;

	switch (fac)
	{
	case 1:
		factory = std::make_shared<Factor1>();
		break;
	case 2:
		factory = std::make_shared< Factor2>();
		break;
	case 3:
		factory = std::make_shared<Factor3>();
		break;
	default:
		std::cout << "Fail choose Factor!";
		return;
	}

	switch (del)
	{
	case 1:
		delivery = std::make_shared< DeliverX>();
		break;
	case 2:
		delivery = std::make_shared< DeliverY>();
		break;
	case 3:
		delivery = std::make_shared< DeliverZ>();
		break;
	default:
		std::cout << "Fail choose Deliver!";
		return;
	}

	switch (pro)
	{
	case 1:
		proA = factory->CreatProductA();
		std::cout << proA->ProductA() << " And " << delivery->Deliver();
		break;
	case 2:
		proB = factory->CreatProductB();
		std::cout << proB->ProductB() << " And " << delivery->Deliver();
		break;
	default:
		std::cout << "Fail choose Product!";
		return;
	}
}
